package com.codepoem.designpattern.observer

/**
 * 具体观察者
 */
class ConcreteObserver() : Observer() {

    var subject: ConcreteSubject? = null
    private var name: String = ""
    private var observerState: String = ""

    constructor(subject: ConcreteSubject, name: String) : this() {
        this.name = name
        this.subject = subject
    }

    override fun update() {
        observerState = subject!!.subjectState
        println("观察者$name 的新状态是$observerState")
    }
}